#include "TranslatorX.h"

TranslatorX::TranslatorX(QWidget *parent, MatrixStack &mtxStack)
: SingleSliderWidget(parent, mtxStack)
{
	setCaption(tr("X translation: 0.0"));
}

void TranslatorX::valueChanged(int newValue)
{
	Matrix &mtx = matrix();
	float value = newValue / 10.0f;

	cml::matrix_translation(mtx, value, 0.0f, 0.0f);

	QString str(tr("X translation: "));
	str.append(QString().sprintf("%s%d.%d", newValue < 0 ? "-" : "", abs(newValue) / 10, abs(newValue) % 10));

	setCaption(str);
}

